package com.base.cn.platform.os.controller.mobile.qa.type;

import com.base.cn.platform.os.common.MobileBaseController;
import com.base.cn.platform.os.common.utils.ObjectUtils;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.service.manage.teacher.SysTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.Map;

/**
 * H5问答分类Controller
 * @author LIZHIPENG
 * @create 2018-06-15 下午 2:36
 */
@Controller
@RequestMapping("/mobile")
public class MobileQaTypeController extends MobileBaseController {

    @Autowired
    private SysTeacherService sysTeacherService;

    /**
     * 提问时，查询讲师的问答分类
     * @param teacherId 讲师ID
     * @return Map<String, Object>
     */
    @RequestMapping("/uc/qa/type/findQaTypeByTeacherId")
    @ResponseBody
    public Map<String, Object> findQaTypeByTeacherId(@RequestParam("teacherId") BigDecimal teacherId){
        Map<String, Object> teacherMap = sysTeacherService.findSysTeacherById(teacherId, false, false, false, false, true);
        if(ObjectUtils.isNotEmpty(teacherMap)){
            return ResultUtil.SUCCESS(teacherMap.get("qaType"));
        }
        return ResultUtil.ERROR("系统繁忙，请稍后重试");
    }
}
